﻿#ifndef __GPS_DEAL_H__
#define __GPS_DEAL_H__
#include <string>

class GPSDeal 
{
public:
	GPSDeal() : LastFixQuality(-1), LastSatsTracked(0),
		LastStationID("0"), LastCorrAge("_"), LastHDOP(0), LastVDOP(0),
		LastPDOP(0), LastAltitude(-1), LastHeading(0), LastSpeed(0),
		LastSpeedSmoothed(0), RecordQueue(""),
		Disp2("age"), Disp3("speed-mph-smoothed") {}
public:
	void ProcessNMEAdata(const std::string &data);
	void WriteRecordingQueueToFile();
	std::string GenerateGPGGAcode();
	std::string CalculateChecksum(const std::string &sentence);
private:
	void ProcessGPGGA(const std::string &code);
	void ProcessGPGSA(const std::string &code);
	void ProcessGPRMC(const std::string &code);
	void RecordLine(const std::string &line);
public:
	int LastFixQuality;
	int LastSatsTracked;
	std::string LastStationID;
	std::string LastCorrAge;
	double LastHDOP;
	float LastVDOP;
	float LastPDOP;
	float LastAltitude;
	float LastHeading;
	float LastSpeed;
	float LastSpeedSmoothed;
	std::string RecordQueue;
	std::string Disp2;
	std::string Disp3;
private:
	float RecentSpeeds[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	
};

#endif // !__GPS_DEAL_H__